package ed.hbut.supermarket1.mapper;

import ed.hbut.supermarket1.entity.Membership;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface MembershipMapper {


    @Insert("insert into membership(MembershipName, MembershipAge, MembershipBirthday, MembershipScore, MembershipPhone) " +
            "VALUE (#{membershipName},#{membershipAge},#{membershipBirthday},#{membershipScore},#{membershipPhone})")
    void addMembership(Membership membership);

    @Select("select * from membership ")
    List<Membership> getAllMembership();

    @Select("select * from membership where MembershipID=#{id}")
    Membership getById(int id);

    @Update("update membership set MembershipName=#{membershipName},MembershipAge=#{membershipAge},MembershipBirthday=#{membershipBirthday},MembershipPhone=#{membershipPhone}" +
            ",MembershipScore=#{membershipScore} where MembershipID=#{membershipID}")
    void updateMembership(Membership membership);

    @Delete("delete from membership where MembershipID=#{id}")
    void deleteMembership(int id);
}
